package cn.kent.controller.vo;


public interface GlobalConst {

    /**
     * 错误码
     *
     * @author yangxingyu
     */
    final class Code {
        //微服务的code
        public final static Integer SUCCESS = 200; //请求成功
        public final static Integer ERROR_400 = 400; // 请求失败
        public final static Integer ERROR_405 = 405; // 请求方式错误
        public final static Integer NO_LOGIN = 409; // 用户未登录
        public final static Integer ERROR_410 = 410; // 请求参数错误或者参数不合法
        public final static Integer REMOTE_ERROR = 411; // 远程请求异常
        public final static Integer FAIL = 500; // 服务器系统异常
    }


    enum ErroCode {
        SERVICE_SUCCESS(200, "成功"),
        NO_LOGIN(409, "用户未登录"),
        SERVICE_PARAM_ERROR(410, "参数校验失败"),
        REMOTE_FAIL(411, "远程接口调用失败"),
        SERVICE_FAIL(2000, "服务异常"),
        SERVICE_APPS_ADD_FAIL(1000, "新增APP失败"),
        SERVICE_APPS_UPDATE_FAIL(1001, "修改APP失败"),
        SERVICE_APPS_DELETE_FAIL(1002, "删除APP失败"),
        SERVICE_APPS_IMAGE_BLACK_FAIL(1003, "上传图片为空"),
        SERVICE_APPS_IMAGE_BIG_FAIL(1004, "上传图片文件大小已超过");


        private int code;
        private String msg;

        private ErroCode(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public String getMsg() {
            return this.msg;
        }

        public int getCode() {
            return this.code;
        }
    }


    interface RegularExpression {
        // 正整数
        String POSITIVE_INTEGER = "[1-9]\\d*";
        // 日期 yyyy-MM-dd HH:mm:ss
        String DATE_TIME = "(((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|((01[0-9]{2}|0[2-9][0-9]{2}|[1-9][0-9]{3})-0?2-(0?[1-9]|1\\d|2[0-8]))|(((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((04|08|12|16|[2468][048]|[3579][26])00))-0?2-29)) (20|21|22|23|[0-1]?\\d):[0-5]?\\d:[0-5]?\\d";
    }
}